package com.lanou.moving.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.lanou.moving.fragment.LoadingFragment;
import com.lanou.moving.fragment.SingleMusicFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 梁树珍 on 15/11/5.
 */
public class DownloadAdapter extends FragmentPagerAdapter{
    private String titles[] = {"单曲", "正在下载"};
    private List<Fragment> fragments;

    public DownloadAdapter(FragmentManager fm) {
        super(fm);
        init();
    }

    private void init(){
        fragments = new ArrayList<>();
        fragments.add(new SingleMusicFragment());
        fragments.add(new LoadingFragment());
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return titles.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
